import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class BaselineDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('BaseLine'),
        centerTitle: true,
      ),
      body: BaseLineUse(),
    );
  }
}

class BaseLineUse extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: <Widget>[
        Baseline(
          //数值，必须要有，从顶部算。基准线位置，是以像素为基本的单位
          baseline: 80,
          //baselineType 定位child的基准线类型，分为两种：alphabetic对齐字符底部的水平线，
          baselineType: TextBaseline.alphabetic,
          child: Text(
            'AaBbCc',
            style: TextStyle(
              fontSize: 18,
              textBaseline: TextBaseline.alphabetic,
            ),
          ),
        ),
        Baseline(
          baseline: 80,
          baselineType: TextBaseline.alphabetic,
          child: Container(
            width: 40,
            height: 40,
            color: Colors.blue,
          ),
        ),
        Baseline(
          baseline: 80,
          baselineType: TextBaseline.alphabetic,
          child: Text(
            'DdEeFf',
            style: TextStyle(
              fontSize: 26,
              textBaseline: TextBaseline.alphabetic,
            ),
          ),
        )
      ],
    );
  }
}
